package ca.concordia.soen6461.wichf.navigation.action;

import java.util.Date;

import ca.concordia.soen6461.wichf.entity.ScheduledEvent;
import ca.concordia.soen6461.wichf.entity.ScheduledEvent.Type;
import ca.concordia.soen6461.wichf.entity.User;
import ca.concordia.soen6461.wichf.navigation.event.ManageAppointmentEvent;
import ca.concordia.soen6461.wichf.service.SchedulingService;

public class DoCancelAppointment extends DoManageAppointment {

	public DoCancelAppointment(SchedulingService schedulingService) {
		super(schedulingService);
	}
	
	@Override
	protected void manageAppointment(SchedulingService schedulingService, ManageAppointmentEvent event, User user, Date from) {
		ScheduledEvent e = schedulingService.cancelAppointment(user, from);
		if (e == null) {
			event.getMessages().add(
				"Could not cancel the specified appointment. It may have been already canceled!"
			);
		}
	}

	@Override
	protected Type getEventType() {
		return null;
	}

}
